<?php /* Smarty version Smarty-3.1.18, created on 2017-05-31 09:08:57
         compiled from "/data/www/mystery/protected/modules/webadmin/views/netquestion/answer.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1886623543552e6fac9615e1-40532058%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '510a8a1df1a8d3bca52bc198e1c99b5d65b33b4d' => 
    array (
      0 => '/data/www/mystery/protected/modules/webadmin/views/netquestion/answer.tpl',
      1 => 1494904920,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1886623543552e6fac9615e1-40532058',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_552e6fac9f3e74_42431490',
  'variables' => 
  array (
    'subject_info' => 0,
    'answer_info' => 0,
    'select' => 0,
    'k' => 0,
    'v' => 0,
    'attach_list' => 0,
    'subject_id' => 0,
    'nq_id' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_552e6fac9f3e74_42431490')) {function content_552e6fac9f3e74_42431490($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("../common/iframe_header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<form name='myForm1' id='myForm1' method='post' action='/webadmin/netQuestion/DoAnswer'>
    <div style='margin:10px;'>
        <table>
            <tr><td><h3>题目：</h3></td><td><h3><?php echo $_smarty_tpl->tpl_vars['subject_info']->value['question_num'];?>
 <?php echo $_smarty_tpl->tpl_vars['subject_info']->value['title'];?>
</h3></td></tr>
            <tr><td>分数：</td><td><input name='answer_score' class="input-text" id="answer_score" type='text' value='<?php echo $_smarty_tpl->tpl_vars['answer_info']->value['answer_score'];?>
'>(标准分：<?php echo $_smarty_tpl->tpl_vars['subject_info']->value['standard_score'];?>
)</td></tr>
            <?php if ($_smarty_tpl->tpl_vars['subject_info']->value['question_type']==2) {?>
            <tr>
                <td>选项：</td>
                <td>
                    <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['select']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                    <input type='<?php if ($_smarty_tpl->tpl_vars['subject_info']->value['question_type_sub']==3||$_smarty_tpl->tpl_vars['subject_info']->value['question_type_sub']==5) {?>radio<?php } else { ?>checkbox<?php }?>' name='answer_option[]' <?php if ($_smarty_tpl->tpl_vars['answer_info']->value&&(in_array($_smarty_tpl->tpl_vars['k']->value,$_smarty_tpl->tpl_vars['answer_info']->value['option']))) {?>checked="checked"<?php }?> value='<?php echo $_smarty_tpl->tpl_vars['k']->value;?>
'/><?php echo $_smarty_tpl->tpl_vars['v']->value;?>

                    <?php } ?>
                </td>
            </tr>
            <?php }?>
            <tr><td>描述：</td><td><textarea name='answer_desc' cols='60' rows='5'><?php echo $_smarty_tpl->tpl_vars['answer_info']->value['answer_desc'];?>
</textarea></td></tr>
            <tr>
                <td>附件：</td>
                <td>
                    <input type='file' id="uploadify">
                    <div id="attach_list">
                        <?php if ($_smarty_tpl->tpl_vars['attach_list']->value) {?>
                        <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['attach_list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                        <a href="<?php echo $_smarty_tpl->tpl_vars['v']->value['url'];?>
" target="_blank"><?php echo $_smarty_tpl->tpl_vars['v']->value['url'];?>
</a><br/>
                        <?php } ?>
                        <?php }?>
                    </div>
                </td>
            </tr>
            <tr><td colspan='2' style="text-align: center;"><input type='submit' class="button" value='提交'></td></tr>
        </table>
            <input type="hidden" name="standard_score" id="standard_score" value="<?php echo $_smarty_tpl->tpl_vars['subject_info']->value['standard_score'];?>
" />
            <input type="hidden" name="answer_id" value="<?php echo $_smarty_tpl->tpl_vars['answer_info']->value['answer_id'];?>
" /> 
            <input type='hidden' name='subject_id' value='<?php echo $_smarty_tpl->tpl_vars['subject_id']->value;?>
' />
        <input name='nq_id' type='hidden' value='<?php echo $_smarty_tpl->tpl_vars['nq_id']->value;?>
' />
    </div>
</form>
<script type='text/javascript' src="/js/jquery.uploadify.min.js"></script>
<link href="/css/uploadify.css" rel="stylesheet">
    <script>
        $(document).ready(function() {     
                var options = {         
                    beforeSubmit:  showRequest,  
                    success:       showResponse,
                    dataType:  'json'
                }
                $('#myForm1').ajaxForm(options); 
                
                $('#uploadify').uploadify({
                    'formData'      : {'nq_id' : <?php echo $_smarty_tpl->tpl_vars['nq_id']->value;?>
, 'subject_id' : <?php echo $_smarty_tpl->tpl_vars['subject_id']->value;?>
},
                    'buttonText' : '选择文件',
                    'fileObjName' : 'upfile',   
                    'swf'      : '/js/uploadify.swf',
                    'fileTypeExts' : '*.gif; *.jpg; *.png;*.mp3;*.mp4',
                    'uploader' : '/webadmin/attach/doanswer?attach_type=answer',
                    'onUploadSuccess' : function(file, data, response) {
                        var obj = eval('(' + data + ')');
                        if (obj.state =='SUCCESS'){
                            alert('上传成功');
                            $('#attach_list').append(obj.url+'<br/>');
                        } else {
                            alert(obj.state);
                        }
                    } 
                });   
        });
            function showRequest(formData, jqForm, options) { 
                //判断还的分值是否超过标准分
                var answer_score = $('#answer_score').val();
                var standard_score = $('#standard_score').val();
                if (answer_score > standard_score) {
                    alert('得分不能大于标准分！');return false;
                }
                return true;
            }
            function showResponse(responseText, statusText, xhr, $form)  { 
                alert(responseText.note);
                if (responseText.status==1) {
                    window.parent.location.reload();
                }
            }
    </script>
    <?php echo $_smarty_tpl->getSubTemplate ("../common/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<?php }} ?>
